
#include "addnew.h"

void addnew(list_head head, day_data dd) {

    linked_list *now;
    linked_list *prev;
    linked_list *new_node = (linked_list *) malloc(sizeof(linked_list));
    new_node->data = dd;
    new_node->next = NULL;
    if (head->next == NULL) {
        head->next = new_node;
    }
    prev = head;
    for (now = head->next; now != NULL; now = now->next) {
        if(verify_time(dd.start_date, now->data.start_date)) break;
        prev = now;
    }
    new_node->next = prev->next;
    prev->next = new_node;
}
